package org.example.mapper;//mybatis中的持久层叫 mapper 层 获取数据

import org.apache.ibatis.annotations.*;
import org.example.pojo.Dept;

import java.util.List;
@Mapper
public interface DeptMapper {
    //查询所有部门信息
    @Select("  select tlias.dept.id, name, create_time, update_time from dept order by update_time desc")
    public  List<Dept> findAll();
    //删除部门
    @Delete("delete from dept where id = #{id}")
    public void deleteById(Integer id);
    //添加部门
    @Insert("Insert into dept (name, create_time, update_time ) values (#{name},#{creatTime},#{updateTime})")
    public void add(Dept dept);
    //根据id查询部门
    @Select("select id, name, create_time, update_time from dept where id = #{id}")
    public Dept findById(Integer id);
    //修改部门
    @Update("update dept set name = #{name}, update_time = #{updateTime} where id = #{id}")
    public void update(Dept dept);

}

